package io.zhifei.modules.sys.system.util;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import io.zhifei.modules.sys.system.entity.user.MenuInfoResult;
import lombok.Data;

import java.util.List;

/**
 * <p> 转成树形数据 </p>
 *
 * @param ：null <br/>
 * @return <br/>
 * @throws
 */
@Data
public class UserTree {

    /**
     * 主键id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "父级ID")
    private Long pid;

    @ApiModelProperty(value = "编码")
    @TableField(exist = false)
    private String code;

    @ApiModelProperty(value = "名称")
    @TableField(exist = false)
    private String title;

    @TableField(exist = false)
    private List<MenuInfoResult> children;

    public void add(MenuInfoResult tree) {
        children.add(tree);
    }


}
